package org.nepu.scr.indexrate.converter.upgraderate.operationreliability;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.upgraderate.operationreliability.AppendixC4;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class AppendixC4Converter implements AttributeConverter<AppendixC4, String> {
    @Override
    public String convertToDatabaseColumn(AppendixC4 appendixC4) {
        return JSONUtil.toJsonStr(appendixC4);
    }

    @Override
    public AppendixC4 convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, AppendixC4.class);
    }
}
